package com.example.demo.util;

public class MyPair<V, K> {
    V name;
    K value;
    public MyPair() {this.name = null; this.value = null;}
    public MyPair(V f,K s){
        this.name = f;
        this.value = s;
    }

    public V getName() {
        return name;
    }

    public void setName(V name) {
        this.name = name;
    }

    public K getValue() {
        return value;
    }

    public void setValue(K value) {
        this.value = value;
    }

    public void setAll(V name, K value) {
        this.name = name;
        this.value = value;
    }

    public boolean equals(Object o) {
        if(!(o instanceof MyPair))
        {
            return false;
        }
        MyPair<V,K> pn = (MyPair<V,K>)o;
        return pn.name.equals(name) && pn.value.equals(value);
    }
    public int hashCode() {
        return name.hashCode() + value.hashCode();
    }

    @Override
    public String toString() {
        return "MyPair{" +
                "name=" + name +
                ", value=" + value +
                '}';
    }
}
